package com.hz.user.interfaces.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hz.base.beans.vo.CommonResult;
import com.hz.base.beans.vo.PageEntity;
import com.hz.base.beans.vo.QueryParams;
import com.hz.beans.code.HzOperateCode;
import com.hz.beans.user.entity.TRecipient;
import com.hz.common.beans.constant.DemoResult;
import com.hz.interfaces.user.inf.ITRecipientInterface;
import com.hz.user.service.inf.ITRecipientService;

/**
 * ITRecipientService
 * @author mcz
 * @since [0.0.1]
 * @version [0.0.1,2018年10月08日]
 */
@Service("tRecipientInterface")
public class TRecipientInterface implements ITRecipientInterface{
	
	@Autowired
	private ITRecipientService tRecipientService;
	

	@Override
	public CommonResult<TRecipient> queryTRecipient(Long id) {
		CommonResult<TRecipient> cr = new DemoResult<>();
		cr = tRecipientService.selectByPrimaryKey(cr,id);
		cr.setOperate(HzOperateCode.QUERY_TRECIPIENT);
		return cr;
	}

	@Override
	public CommonResult<TRecipient> addTRecipient(TRecipient tRecipient) {
		CommonResult<TRecipient> cr = new DemoResult<>();
		cr = tRecipientService.insert(cr, tRecipient);
		cr.setOperate(HzOperateCode.ADD_TRECIPIENT);
		return cr;
	}
	
	@Override
	public CommonResult<PageEntity> queryForPage(QueryParams<TRecipient> queryParams) {
		CommonResult<PageEntity> cr = new DemoResult<>();
		cr = tRecipientService.queryForPage(cr, queryParams);
		cr.setOperate(HzOperateCode.QUERY_TRECIPIENT_PAGE);
		return cr;
	}

	@Override
	public CommonResult<List<TRecipient>> queryTRecipientList(QueryParams<TRecipient> queryParams) {
		CommonResult<List<TRecipient>> cr = new DemoResult<>();
		cr = tRecipientService.queryForList(cr, queryParams);
		cr.setOperate(HzOperateCode.QUERY_TRECIPIENT_LIST);
		return cr;
	}

	@Override
	public CommonResult<TRecipient> updateTRecipient(TRecipient tRecipient) {
		CommonResult<TRecipient> cr = new DemoResult<>();
		cr = tRecipientService.updateByPrimaryKey(cr, tRecipient);
		cr.setOperate(HzOperateCode.UPDATE_TRECIPIENT);
		return cr;
	}

	@Override
	public CommonResult<Object> deleteTRecipientArray(Long[] ids) {
		CommonResult<Object> cr = new DemoResult<>();
		cr = tRecipientService.deleteObjectArray(cr, ids);
		cr.setOperate(HzOperateCode.DELETE_TRECIPIENT);
		return cr;
	}

	@Override
	public CommonResult<TRecipient> insertSelective(TRecipient tRecipient) {
		CommonResult<TRecipient> cr = new DemoResult<>();
		cr = tRecipientService.insertSelective(cr, tRecipient);
		cr.setOperate(HzOperateCode.INSERTSELECTIVE_TRECIPIENT);
		return cr;
	}

	@Override
	public CommonResult<Object> deleteByList(List<TRecipient> tRecipientList) {
		CommonResult<Object> cr = new DemoResult<>();
		cr = tRecipientService.deleteByList(cr, tRecipientList);
		cr.setOperate(HzOperateCode.DELETELIST_TRECIPIENT);
		return cr;
	}

	@Override
	public CommonResult<List<TRecipient>> batchUpdate(List<TRecipient> tRecipientList) {
		CommonResult<List<TRecipient>> cr = new DemoResult<>();
		cr = tRecipientService.batchUpdate(cr, tRecipientList);
		cr.setOperate(HzOperateCode.BATCHUPDATE_TRECIPIENT);
		return cr;
	}

	@Override
	public CommonResult<List<TRecipient>> batchSave(List<TRecipient> tRecipientList) {
		CommonResult<List<TRecipient>> cr = new DemoResult<>();
		cr = tRecipientService.batchSave(cr, tRecipientList);
		cr.setOperate(HzOperateCode.BATCHSAVE_TRECIPIENT);
		return cr;
	}

}
